﻿@model Project.Models.contacto
@using Project.Models
 

@{
    ViewBag.Title = "AgregarContactos";
    Layout = "~/Views/Shared/_LayoutPublicaciones.cshtml";

   
}
 
 
    <link href="@Url.Content("~/Content/themes/tablas.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
 
@{var n=((List<contacto>)ViewData["listt"]);
   
  if(n.Capacity>0){
  
    <h2>Seleciona la ficha del contacto a Utilizar</h2>
 
 

     <table id="default">
    <tr>
       
        <th>
            Nombre
        </th>
        <th>
            Direccion
        </th>
        <th>
           Telefono
        </th>
        <th>
           Celular
        </th>
        <th>
           Fax
        </th>
        <th>
            Email
        </th>
        <th>
            Compañia
        </th>
               <th>
            Fecha de Creacion
        </th>
        <th></th>
    </tr>
          
@foreach (contacto item in ((List<contacto>)ViewData["listt"])) {
    <tr>
        
        <td>
            @Html.DisplayFor(modelItem => item.nombre)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.direccion)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.telefono)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.celular)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.fax)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.email)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.company)
        </td>
        
        <td>
            @Html.DisplayFor(modelItem => item.createdDate)
        </td>
        <td>
       <div class="btn-group">
    <button class="btn">@Html.ActionLink("Seleccionar", "Edit", new { id = item.idContacto }) </button> 
  <a class="btn btn-primary dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a>
  <ul class="dropdown-menu">
      <li>@Html.ActionLink("Detalles ", "Edit", new { id = item.idContacto })</li>
     <li> @Html.ActionLink("Modificar", "EditContacto", new {  id=item.idContacto })  </li>
    
       <li> @Html.ActionLink("Eliminar", "Edit", new {  id=item.idContacto }) </li>
 
   
  </ul>
</div>
             
        
       
        </td>
    </tr>
}

</table>
     <br /><br />
 <br /><br />
 
 






  <hr /><br />
}}
     <h2>Agregar nueva ficha de Contacto</h2>
@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
  
            <table style="width: 100%;">
        <tr>
            <td>    @Html.LabelFor(model => model.nombre, "Nombre de Contacto:")</td>
            <td>  @Html.EditorFor(model => model.nombre)
            @Html.ValidationMessageFor(model => model.nombre)</td>
            <td> @Html.LabelFor(model => model.telefono, "Telefono:")</td>
            <td>  @Html.EditorFor(model => model.telefono)
            @Html.ValidationMessageFor(model => model.telefono)</td>
        </tr>
        <tr>
            <td>   @Html.LabelFor(model => model.celular, "Celular:")</td>
            <td>  @Html.EditorFor(model => model.celular)
            @Html.ValidationMessageFor(model => model.celular)</td>
            <td>@Html.LabelFor(model => model.fax, "Fax:")</td>
            <td> @Html.EditorFor(model => model.fax)
            @Html.ValidationMessageFor(model => model.fax)</td>
        </tr>
        <tr>
            <td>  @Html.LabelFor(model => model.email, "Email:")</td>
            <td>  @Html.EditorFor(model => model.email)
            @Html.ValidationMessageFor(model => model.email)</td>
            <td> @Html.LabelFor(model => model.company, "Nombre de la Compañia:")</td>
            <td>  @Html.EditorFor(model => model.company)
            @Html.ValidationMessageFor(model => model.company)</td>
        </tr>
 <tr> 
     <td> @Html.LabelFor(model => model.direccion, "Direccion:")</td>
    
 </tr>
                <tr> <td> @Html.TextAreaFor(model => model.direccion)
            @Html.ValidationMessageFor(model => model.direccion)</td></tr>

                
    </table>

                <p>
            <input type="submit" class="btn btn-danger" value="Utilizar este Contacto" />
        </p>
}

 
